Skip to content

Conversation

@bagusnl
Copy link
Member

@bagusnl bagusnl commented Dec 29, 2025

Main Goal

Fix global RPC toggle not actually disabling RPC.
Also disable RPC regional setting when global toggle is set to disabled.

Closes #806

PR Status :

  • Overall Status : Done
  • Commits : Done
  • Synced to base (Collapse:main) : Yes
  • Build status : OK
  • Crashing : No
  • Bug found caused by PR : 0

Templates

Changelog Prefixes
  **[New]**
  **[Imp]**
  **[Fix]**
  **[Loc]**
  **[Doc]**

@bagusnl bagusnl requested a review from a team December 29, 2025 18:28
@bagusnl bagusnl self-assigned this Dec 29, 2025
@bagusnl bagusnl added Bug Something isn't working Area: Runtime Issue labeled for runtime, Hi3Helper.Core and other libraries used by Collapse Priority: Medium Size: Small labels Dec 29, 2025
@bagusnl
Copy link
Member Author

bagusnl commented Dec 30, 2025

@sentry review

Copy link
Member

@neon-nyan neon-nyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all should be good except for those request changes below.

Use direct assignment to field and use implicit cast instead of ToBoolNullable() as the boolean will return false as default value afterwards.
private int barWidth;
private int consoleWidth;

private readonly bool IsRpcEnabled_QS = AppDiscordPresence?.IsRpcEnabled ?? false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The readonly field IsRpcEnabled_QS is initialized with a stale false value because AppDiscordPresence is null during HomePage construction, permanently disabling the RegionRpcToggle.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

The readonly field IsRpcEnabled_QS in HomePage.xaml.cs is initialized at a point in the application startup sequence where AppDiscordPresence is still null. This causes the field to be permanently set to false due to the null-coalescing operator (?? false). The UI's RegionRpcToggle is bound to this readonly field, and as a result, it will always be disabled. This prevents users from interacting with the regional RPC toggle, even when the global RPC setting is enabled, which defeats the purpose of the new control.

💡 Suggested Fix

Instead of using a readonly field, convert IsRpcEnabled_QS into a property with a getter that dynamically reads the current state from AppDiscordPresence.IsRpcEnabled. This ensures the UI binding always reflects the up-to-date value of the global RPC setting. Also, consider implementing INotifyPropertyChanged to update the UI dynamically if the global setting can change while the page is open.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs#L82

Potential issue: The `readonly` field `IsRpcEnabled_QS` in `HomePage.xaml.cs` is
initialized at a point in the application startup sequence where `AppDiscordPresence` is
still `null`. This causes the field to be permanently set to `false` due to the
null-coalescing operator (`?? false`). The UI's `RegionRpcToggle` is bound to this
`readonly` field, and as a result, it will always be disabled. This prevents users from
interacting with the regional RPC toggle, even when the global RPC setting is enabled,
which defeats the purpose of the new control.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 513280

@neon-nyan neon-nyan merged commit 7f98f67 into main Jan 4, 2026
8 of 9 checks passed
@bagusnl bagusnl mentioned this pull request Jan 4, 2026
bagusnl added a commit that referenced this pull request Jan 4, 2026
# What's changed? - 1.83.14
- **[New]** Allow game process to be run as child process of Collapse,
by @gablm
  - This allows stuff like Steam Overlay/controls to work.
  - User can enable it under Game Settings -> Advanced Settings.
- **[New]** [ZZZ] DirectX 12 and Ray Tracing experimental settings, by
@neon-nyan
- User can use DirectX 12 and RT/Upscaling in-game natively. You will
need to enable the DirectX 12 option under game settings.
- Availability of certain options depends on the system you are running
on.
- Do note that the game **MIGHT stutter** on any new scene/sprite loads,
and depending on your system it might be slow/fast.
  - The longer you play, the stutter should go away.
- Ray tracing comparison:
#853 (comment)
- **[Fix]** Misc settings not loading, by @gablm 
  - This affected stuff like Advanced game settings, command line, etc
- **[Imp]** Reduce CPU usage in Discord RPC module, by @neon-nyan 
  - More details: #845
- **[Fix]** Plugin news not reloaded on page/region refresh, by @gablm 
- **[Fix]** [ZZZ] Game Settings reset after using Collapse' GSP, by
@shatyuka
- **[Fix]** Discord RPC did not get disabled globally, by @bagusnl
@neon-nyan
  - More details: #849
- **[Fix]** HSR Repair/Cache update method, by @neon-nyan 
  - More details: #852
  - TL;DR: Completely rewritten
- **[Fix]** Sophon not resuming update, by @neon-nyan 
- After cancelling/pausing game update, the launcher should now perform
checks on which assets already updated so only the necessary files are
getting downloaded.
- **[Fix]** [ZZZ] Deleted assets gets redownloaded on update, by
@neon-nyan
  - More details: #854
- **[Fix]** Game update does not work on games without separate audio
package, by @gablm
- **[Fix]** Playtime counter not stopped after user switched game/region
mid-session, by @gablm
- **[Fix]** Directory might not get created when updating game through
Sophon, by @neon-nyan
- **[Fix]** Main Page's Carousel did not get stopped/paused when told
to, by @bagusnl
- Carousel now should get paused if you sent Collapse to tray or when
Collapse is not on the foreground.
- This is interim fix while the whole background subsystem is getting
rewritten by @neon-nyan.
  - More details: #846

### Templates

<details>
  <summary>Changelog Prefixes</summary>
  
  ```
    **[New]**
    **[Imp]**
    **[Fix]**
    **[Loc]**
    **[Doc]**
  ```

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Runtime Issue labeled for runtime, Hi3Helper.Core and other libraries used by Collapse Bug Something isn't working Priority: Medium Size: Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: trying to connect discord rpc even disable all discord features

4 participants